package org.davidtrevien.com.imput.omi.imputomi;

import javax.swing.JToggleButton;

import org.davidtrevien.com.imput.omi.callback.NavigationCallback;
import org.davidtrevien.utils.controler.Controller;

public class ImputOmiCtrl
	extends Controller<ImputOmiView> {

	public ImputOmiCtrl() {
		initComponent();
	}
	
	protected void initComponent() {
		NavigationCallback callback = createNavigationCallback();
		
		this.view = new ImputOmiView(callback);
	}

	private NavigationCallback createNavigationCallback() {
		NavigationCallback callback = new NavigationCallback() {
			
			@Override
			public void notifyNavigationToggleChanged(JToggleButton button) {
				String buttonName = button.getName();
				if ("planning".equals(buttonName)) {
					displayPlanning();
				}
				else if ("imputation".equals(buttonName)) {
					displayImputation();
				}
				else if ("holiday".equals(buttonName)) {
					displayHoliday();					
				}
				else if ("os".equals(buttonName)) {
					displayOs();					
				}
				else if ("param".equals(buttonName)) {
					displayParam();
				}
			}
		};
		
		return callback;
	}
	
	public void displayPlanning() {
		this.view.centerCtrl.displayPlanning();
	}
	
	public void displayOs() {
		this.view.centerCtrl.displayOs();	
	}
	
	public void displayHoliday() {
		this.view.centerCtrl.displayHoliday();	
	}
	
	public void displayImputation() {
		this.view.centerCtrl.displayImputation();
	}
	
	public void displayParam() {
		this.view.centerCtrl.displayParam();
	}
}
